<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>constructor中执行super</title>
</head>
<body>
    <script>
        class User{
            constructor(name){
                this.name = name;
            }
        }

        class Admin extends User{
            // 如果子类中不写constructor，默认执行下面这段
            // constructor(...args){
            //     super(...args);
            // }


            // 如果子类中有自己的属性，一定要放在super的后面
            constructor(...args){
                super(...args);
                this.name = 'houdunren';
            }

            show(){
                console.log(this.name);
            }
        }

        let admin = new Admin("后盾人");
        admin.show();
    </script>
</body>
</html>